home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
ici
/
ici.cpi
/
int.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-27
|
859b
|
62 lines
#include "int.h"
STATIC long
mark_int(o)
object_t *o;
{
o->o_flags |= O_MARK;
return sizeof(int_t);
}
STATIC int
cmp_int(i1, i2)
int_t *i1;
int_t *i2;
{
return i1->i_value != i2->i_value;
}
STATIC long
hash_int(i)
int_t *i;
{
return i->i_value * 7;
}
int_t *
new_int(v)
long v;
{
register int_t *i;
/*
* There is an in-line copy of this near the end of binop.h
*/
if ((i = atom_int(v)) != NULL)
{
got(i);
return i;
}
if ((i = talloc(int_t)) == NULL)
return NULL;
objof(i)->o_type = &int_type;
objof(i)->o_tcode = TC_INT;
objof(i)->o_flags = 0;
objof(i)->o_nrefs = 1;
rego(i);
i->i_value = v;
return intof(atom(objof(i), 1));
}
type_t int_type =
{
mark_int,
free_simple,
hash_int,
cmp_int,
copy_simple,
assign_simple,
fetch_simple,
"int"
};